<template>
  <div class="headers">
    <div class="footer">
      <router-view></router-view>
      <van-tabbar v-model="active" active-color="#ee0a24" inactive-color="#000">
        <van-tabbar-item replace to="/shopsindex/goodtype" icon="home-o"
          >菜品分类</van-tabbar-item
        >
        <van-tabbar-item replace icon="chat-o" to="/shopsindex/good" badge="99+"
          >菜品详情</van-tabbar-item
        >
        <van-tabbar-item replace icon="orders-o" dot>订单</van-tabbar-item>
        <van-tabbar-item replace to="/shopsindex/shopsinfo" icon="user-circle-o"
          >个人主页</van-tabbar-item
        >
      </van-tabbar>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      list: [],
    };
  },
  methods: {
    // 跳转到登录
    login: function () {
      this.$router.push({ name: "login" });
    },
    // 跳转到注册
    register: function () {
      this.$router.push({ name: "register" });
    },
    // 跳转到商家入驻
    shopsreg: function () {
      this.$router.push({ name: "shopsreg" });
    },
    // 跳转到商家登录
    shopslogin: function () {
      this.$router.push({ name: "shopslogin" });
    },
    // 退出登录方法
    logout: function () {
      // 删除localstorage
      localStorage.removeItem("token");
      localStorage.removeItem("nickname");
      localStorage.removeItem("id");
      this.name = "";
      // 跳转
      window.location.href = "/shopsindex/shopsinfo";
    },
  },
  created() {
    // 判断用户是否登录
    if (localStorage.getItem("token") != null) {
      this.name = localStorage.getItem("name");
    } else {
      this.name = "";
    }
  },
};
</script>

<style scoped>
</style>